package com.jd.controller;

import com.jd.domain.Store;
import com.jd.service.StoreSevice;
import com.jd.untils.AjaxResutl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/store")
public class StoreController {
    @Autowired
    private StoreSevice storeSevice;
    @PostMapping("/add")
    public AjaxResutl add(@RequestBody Store store){
        try {
            storeSevice.add(store);
            return new AjaxResutl();
        } catch (Exception e) {
            e.printStackTrace();
            return new AjaxResutl(false,"操作失败");
        }
    }
}
